local Json = require("common.Json")
local Msg = require("core.Msg")
--local Util = require("common.Util")

InnerDataLRegList = InnerDataLRegList or {}

function Register(oType, oHandleL)
    InnerDataLRegList[oType] = {handleL = oHandleL}
end

function ProcessLCB(oHuman, oType, oData)
    local nData = Json.Decode(oData) 
    if InnerDataLRegList[oType] and InnerDataLRegList[oType].handleL then
        InnerDataLRegList[oType].handleL(oHuman, oType, nData)
    end
end

function Send2WInnerData(oHuman, oType, oData)
    local nMsg = Msg.lw.LW_INNER_DATA
    nMsg.type = oType
    nData = Json.Encode(oData)
    if nData then
        nMsg.data = nData
    else
        return false
    end
    Msg.send2world(nMsg, oHuman and oHuman._id or "")
    return true
end
